package com.foreknow.dao;

import org.apache.commons.dbutils.ResultSetHandler;

import java.sql.SQLException;
import java.util.List;


public interface IBaseDao<T> {
    /**
     * 删除
     * @param sql
     * @param params
     * @return
     * @throws SQLException
     */
    public  int delete(String sql,Object...params) throws SQLException;

    /**
     * 删除
     * @param sql
     * @return
     * @throws SQLException
     */
    public  int delete(String sql) throws SQLException;

    /**
     * 添加
     * @param sql
     * @param params
     * @return
     * @throws SQLException
     */
    public  int insert(String sql,Object[] params) throws SQLException;

    /**
     * 条件来查询
     * @param sql
     * @return
     * @throws SQLException
     */
    public List<T> queryByCondition(String sql) throws  SQLException;

    /**
     * 条件查询
     * @param sql
     * @param params
     * @return
     * @throws SQLException
     */
    public List<T> queryByCondition(String sql,Object...params) throws  SQLException;

    /**
     * 查询一个对象
     * @param sql
     * @param param
     * @return
     * @throws SQLException
     */
    public T queryOne(String sql, Object... param)throws SQLException;

    /**
     * 修改
     * @param sql
     * @param params
     * @return
     * @throws SQLException
     */
    public  int update(String sql,Object...params) throws SQLException;

    /**
     * 修改
     * @param sql
     * @param param
     * @return
     * @throws SQLException
     */
    public  int update(String sql,Object param)throws SQLException;

    /**
     *
     * @return
     */
    public ResultSetHandler<T> getResultSetHandler();
}






















